function show_BubbleNotice(t,e){td__showBubbleNotice(t,e,"")}function close_BubbleNotice(t){td__closeBubbleNotice(t)}function td__showBubbleNotice(t,e,o){void 0===e&&(e=6e3);var n=document.querySelectorAll(".td__cornernotice").length+1,i=document.querySelector(".t-help-bubble"),i=(i&&(i.style.display="none"),document.getElementById("tc-news")),i=(i&&(i.style.display="none"),document.querySelector(".tc-errors"));i&&(i.style.display="none");document.body.insertAdjacentHTML("beforeend",'
");var r=document.querySelector('.td__cornernotice[data-tilda-corner-notice="'+n+'"]');1'),(c=document.getElementById(e))&&updatePinPosition(c),c&&c.addEventListener("mouseover",function(){var t;this.classList.contains("onboardingpin_opened")||(this.classList.add("onboardingpin_opened"),(t=this.querySelector(".onboardingpin__bubble"))&&(t.style.removeProperty("transition"),t.style.opacity="0",t.style.transition="opacity 500ms ease-out",t.style.opacity="1"),document.querySelector(".onboardingpin__filter")||(l.insertAdjacentHTML("afterbegin",''),document.querySelector(".onboardingpin__filter"),t.style.transition="opacity 300ms ease-out",t.style.opacity="0.7",t.addEventListener("click",closeOnboardingPinHtml)),localStorage.setItem("tp-pin-"+e,Date.now()))}),(o=document.querySelector(".onboardingpin__btn-close"))&&o.addEventListener("click",closeOnboardingPinHtml),c&&setInterval(updatePinPosition.bind(null,c),2e3))}function updatePinPosition(t){var e,o,n,i,r,s,a;t&&(e=t.getAttribute("data-pin-left"),e=parseInt(e,10)||0,o=t.getAttribute("data-pin-top"),o=parseInt(o,10)||0,n=t.getAttribute("data-pin-fixed")||"",i=a=0,(r=(s=t.getAttribute("data-pin-elem")||"")?document.querySelector(s):r)&&(a=(s=r.getBoundingClientRect()).left+window.pageXOffset,"fixed"!==n)&&(i=s.top+window.pageYOffset),"fixed"===n&&(t.style.position="fixed"),t.style.left=e+a+"px",t.style.top=o+i+"px")}function closeOnboardingPinHtml(){var t=document.querySelector(".onboardingpin_opened"),t=(t&&t.remove(),document.querySelector(".onboardingpin__filter"));t&&t.remove()}function check_logout(t){if("string"==typeof t&&"\x3c!--tlp--\x3e"===t.substring(0,10))throw window.location="/login/",new Error("Sorry, you logout!");if("string"==typeof t&&"\x3c!--tpbaa--\x3e"===t.substring(0,12))throw window.location="/projects/",new Error("Sorry, this page belongs to another account!")}function str_stripTags(t){return t="string"==typeof t?t&&t.replace(/(<([^>]+)>)/gi,""):t}function getCSRF(){var t,e;return"string"==typeof window.csrf&&window.csrf?window.csrf:(e="notset",(t=document.getElementById("csrf"))?void 0===(e=t.getAttribute("content"))||e?void 0===e&&(e="err. is undefined."):e="err. is empty. "+e:e="err. len is: 0",e)}function logAjaxError(t,e,o,n,i){console.log("Sending API error to stat.."),void 0===n&&(n=""),void 0===o&&(o=""),void 0===e&&(e=""),"object"==typeof i&&null!==i||(i={}),void 0!==window.userid&&(i.userid=window.userid),void 0!==window.projectid&&(i.projectid=window.projectid),void 0!==window.pageid&&(i.pageid=window.pageid),void 0!==window.usercountry&&(i.usercountry=window.usercountry),void 0!==window.lang&&(i.lang=window.lang);var r=new XMLHttpRequest;r.open("POST","https://sysstat.tildacdn.com/api/ajax/error/",!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({account_id:"cc",event_id:(new Date).getTime()+"-"+Math.floor(1e5*Math.random()),url:t,data:e,status_code:n,message_text:o,location:window.location.href,debug:i}))}function logNetworkError(t,e,o,n,i){console.log("Sending Network error to stat.."),void 0===t&&(t=""),void 0===o&&(o=""),"object"==typeof i&&null!==i||(i={}),0<(n=void 0===n?"":n)&&(n=parseInt(n)),void 0!==window.userid&&(i.userid=window.userid),void 0!==window.projectid&&(i.projectid=window.projectid),void 0!==window.pageid&&(i.pageid=window.pageid),void 0!==window.usercountry&&(i.usercountry=window.usercountry),void 0!==window.lang&&(i.lang=window.lang);var r=new XMLHttpRequest;r.open("POST","https://sysstat.tildacdn.com/api/net/error/",!0),r.setRequestHeader("Content-Type","application/json"),r.send(JSON.stringify({account_id:"cc",type:t,url:e,data:o,time:n,location:window.location.href,debug:i}))}function errorLog(t){console.log("Sending API error to stat.."),td__ajax({url:"https://sysstat.tildacdn.com/api/ajax/error/",dataToSend:t,ui:{isQuiet:!0},onSuccess:function(){console.log("Error log sent ok")}})}function showAlert(t,e){void 0===e&&(e=6e3);var o=document.querySelector(".t-help-bubble");o&&(o.style.display="none");document.body.insertAdjacentHTML("beforeend",'");o=document.querySelector(".cornernotice");o.style.transitionProperty="opacity, right",o.style.transitionDuration="400ms",o.style.transitionTimingFunction="ease-in",o.style.opacity="1",o.style.right="20px",setTimeout(closeAlert,e),o.querySelector(".cornernotice__close").addEventListener("click",closeAlert)}function closeAlert(){var e=document.querySelector(".cornernotice");e&&(e.style.transitionDuration="300ms",e.style.transitionTimingFunction="ease-out",e.style.opacity="0",e.style.right="0px",setTimeout(function(){e.remove();var t=document.querySelector(".t-help-bubble");t&&(t.style.display="block")},300))}function logout(){var t=document.querySelector(".t-menu__item-exit"),e=(t&&(t.style.pointerEvents="none",t.style.opacity="0.5"),{comm:"logout",csrf:getCSRF()});void 0!==window.xhr_submit&&window.xhr_submit.abort(),window.xhr_submit=td__ajax({url:"/identity/submit/logout/",dataToSend:e,ui:{ctext:"logout"},onSuccess:function(t){var e;""!==t&&"logout"===t.substring(0,6)?0\t\t\t
\t\t\t
'+(e.title?'
'+e.title+"
":"")+'\t\t\t\t
\t\t\t\t\t'+e.msg+'\t\t\t\t
\t\t\t
\t\t\t\t\t
\t
",e.placeToInsert?e.placeToInsert.insertAdjacentHTML("afterend",s):document.body.insertAdjacentHTML("beforeend",s),document.body.classList.add("td-body_popup-opened"),document.body.classList.add("t-body_popupshowed"),(t=document.getElementById(r[o].id))&&t.classList.add("td-popup_opened"),n=function(){document.body.removeEventListener("keydown",i),document.body.classList.remove("td-body_popup-opened"),document.body.classList.remove("t-body_popupshowed"),t.remove()},i=function(t){t.stopPropagation(),(27==t.keyCode||13==t.keyCode&&"alert"===o)&&(n(),"function"==typeof e.noCallback)&&e.noCallback()},document.body.addEventListener("keydown",i),(s=t&&t.querySelector(".js-ps-popup-ok"))&&s.focus(),s&&s.addEventListener("click",function(){n(),"function"==typeof e.okCallback&&e.okCallback()}),(r=t&&t.querySelector(".js-ps-popup-yes"))&&r.focus(),r&&r.addEventListener("click",function(){n(),"function"==typeof e.yesCallback&&e.yesCallback()}),s=t.querySelector(".js-ps-popup-no"))&&s.addEventListener("click",function(){n(),"function"==typeof e.noCallback&&e.noCallback()}))}function tc__showConfirmPhraseDialog(t){const{title:e,message:o="",cancelBtnText:n="Cancel",confirmBtnText:i="Disable",confirmPhrase:r="Disable",onConfirmClick:s}=t;t=`
`,t=tc__translate(t,"lkp__dict");document.body.insertAdjacentHTML("beforeend",t);const a=document.querySelector(".js-tc-confirm-popup"),c=a.querySelector(".js-tc-confirm-popup-input"),d=a.querySelector(".js-tc-confirm-popup-disable-btn"),l=a.querySelector(".js-tc-confirm-popup-cancel-btn");const p=()=>{document.body.removeEventListener("keydown",_),document.body.classList.remove("td-body_popup-opened"),document.body.classList.remove("t-body_popupshowed"),a.remove()},u=()=>{c.disabled=!0,d.disabled=!0,l.disabled=!0},h=()=>{c.disabled=!1,d.disabled=!1,l.disabled=!1},m=()=>{c.value===r&&s&&(u(),Promise.resolve(s()).catch(()=>{h()}).finally(()=>{p()}))};const _=t=>{t.stopPropagation(),27==t.keyCode&&p(),13==t.keyCode&&m()};document.body.addEventListener("keydown",_),d.addEventListener("click",m),l.addEventListener("click",p),c.addEventListener("input",t=>{t.target.value===r?d.disabled=!1:d.disabled=!0}),document.body.classList.add("td-body_popup-opened"),document.body.classList.add("t-body_popupshowed"),a.classList.add("td-popup_opened"),c.focus()}function td__encodeData(t,n){var e,i="";if(Array.isArray(t))Array.prototype.forEach.call(t,function(t,e){var o;"object"==typeof t&&"name"in t?(i+=i?"&":"",o="",o=n?encodeURIComponent(n+"["+t.name+"]"):encodeURIComponent(t.name),i+=o+"="+encodeURIComponent(t.value)):"string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t?(i+=i?"&":"",o="",o=n?encodeURIComponent(n+"["+e+"]"):encodeURIComponent(e),i+=o+"="+encodeURIComponent(t)):"object"==typeof t&&(i=(i+=i?"&":"")+td__encodeData(t,n?n+"["+e+"]":e))});else if("object"==typeof t&&null!==t)for(var o in t)i+=i?"&":"","object"==typeof t[o]&&null!==t?i+=td__encodeData(t[o],n?n+"["+o+"]":o):"string"!=typeof t[o]&&"number"!=typeof t[o]&&"boolean"!=typeof t[o]&&null!==t[o]||(e="",e=n?encodeURIComponent(n+"["+o+"]"):encodeURIComponent(o),i+=e+"="+encodeURIComponent(t[o]));return i}function td__ajax(t){var e,o,n,i,r=t.url,s=t.dataToSend||"",a=t.ui||{isQuiet:!1,ctext:""},c=(a.ctext||(a.ctext=""),t.onSuccess),d=t.onError,l=t.onComplete,p=t.responseType||"text",t=t.method||"POST";if(r)return e=!1,"/page/publish/"===r||a.isQuiet||(showLoadIcon(),e=!0),o=Date.now(),(n=new XMLHttpRequest).open(t,r,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.timeout="/page/publish/"===r?4e4:25e3,n.responseType=p,i=td__encodeData(s),n.addEventListener("loadend",function(){tc__checkServerError(this)?tc__drawServerError(this.responseText):200<=this.status&&this.status<400?(e&&hideLoadIcon(),"function"==typeof c&&c.call(this,"json"===p?this.response:this.responseText),"function"==typeof l&&l.call(this)):this.dispatchEvent(new Event("error"))}),n.addEventListener("timeout",function(){e&&hideLoadIcon();var t=Date.now()-o;logNetworkError("ajax",r,s,t/1e3,{}),a.isQuiet||("function"==typeof tc__showDialog?tc__showDialog({msg:"Request timeout ("+a.ctext+"). Please reload the page and try again."},"alert"):alert("Request timeout ("+a.ctext+"). Please reload the page and try again.")),"function"==typeof d&&d.call(this,"timeout"),"function"==typeof l&&l.call(this)}),n.addEventListener("abort",function(){e&&hideLoadIcon(),"function"==typeof d&&d.call(this,"abort"),"function"==typeof l&&l.call(this)}),n.addEventListener("error",function(){e&&hideLoadIcon();var t=Date.now()-o;console.log(this.status),400<=n.status?(a.isQuiet||td__showBubbleNotice("Error status: "+this.status+". (action: "+a.ctext+")",6e3,"error"),logAjaxError(r,s,"comm: "+s.comm+", (td__ajax)",n.status,{ts_delta:parseInt(t/1e3),exception:"error",ui:a})):0===n.status&&t<100&&!a.isQuiet&&("function"==typeof tc__showDialog?tc__showDialog({msg:"Request error ("+a.ctext+"). Please check your Internet connection and try again."},"alert"):alert("Request error ("+a.ctext+"). Please check your Internet connection and try again.")),"function"==typeof d&&d.call(this,"error"),"function"==typeof l&&l.call(this)}),i&&"POST"===t?n.send(i):n.send(),n}function tc__checkServerError(t){return 200===t.status&&!("string"!=typeof t.response||!t.response.startsWith("Error(TNL-RQS")&&(!t.response.startsWith("Error(")||"-TNL"!==t.response.substring(9,13)))}function tc__drawServerError(t){var e=t.substring(6,t.indexOf(")")),o=t.substring(t.indexOf(".")+1),e='Server error: '+e+""+(""!==o?'
('+o.toLowerCase()+")":"")+"
Sorry, it looks like we have an internal server error.
"+t+'
Please wait for a minute, reload the page, and try again.
If you continue to see this message multiple times, please contact us at:
team@tilda.cc ';document.body.innerHTML=e}function td__other__getIcon(t){switch(t){case"download":return`
`;case"api":return`
`;case"user":return`
`;case"trash":return`
`;case"settings":return`
`;case"code":return`
`;case"copy":return`
`;case"move":return`
`}}function tc__loadFile(l,p,u){return new Promise((t,e)=>{var o="style"===p,n=o?"link":"script",i=o?"href":"src";let r;try{var{pathname:s,origin:a,href:c}=new URL(l,window.location.href);r=c.includes("tilda")?s:a+s}catch(t){r=l}c=document.querySelector(n+`[${i}*="${r}"]`);if(c)return"true"===c.getAttribute("data-loading")?(c.addEventListener("load",t),void c.addEventListener("error",e)):t();const d=document.createElement(n);d.setAttribute(i,l),o&&(a=u&&u.rel?u.rel:"stylesheet",d.setAttribute("rel",a)),d.setAttribute("data-loading","true"),d.addEventListener("load",()=>(d.removeAttribute("data-loading"),t())),d.addEventListener("error",()=>(document.head.removeChild(d),e())),document.head.appendChild(d)})}function tc__loadResource(t){var e=t.split(".").pop(),t=t+(window.ver?"?v="+window.ver:"");return"css"===e?tc__loadFile(t,"style"):"js"===e?tc__loadFile(t,"script"):Promise.reject("Unknown resource extension. Make sure the resource url ends with .css or .js")}function tc__clearPageAlias(t){if("string"!=typeof t)return"";let e=t;return e=(e=(e=(e=(e=e.toLowerCase()).replace(/[^a-z0-9_\-|\/]/g,"")).replace(/^\/+/g,"")).replace(/\/+$/g,"/")).replace(/\/{2,}/g,"/")}function tc__createMemoFunction(t,e,o){return o.has(t)?o.get(t):(e=e(t),o.set(t,e),e)}function tc__eventEmitter(){const o=[];return{on:t=>{o.push(t)},trigger:(...e)=>{o.forEach(t=>t(...e))},remove:t=>{for(var e;-1<(e=o.indexOf(t));)o.splice(e,1)}}}window.showLoadIcon=function(){var t=document.getElementById("loadicon");t||(document.body.insertAdjacentHTML("beforeend",''),t=document.getElementById("loadicon")),t.style.display="block"},window.hideLoadIcon=function(){var t=document.getElementById("loadicon");t&&(t.style.display="none")},"function"==typeof window.jQuery&&(window.jQuery.cachedScript=function(t){return window.jQuery.ajax({dataType:"script",cache:!0,url:t})});const tc__scrollGuard__cache=new WeakMap;function tc__scrollGuard(t){var e;t instanceof HTMLElement&&(e=tc__createMemoFunction(t,a=>{const s=(t,e)=>{var o,n,i,r=[];let s=t;for(;a.contains(s);)o=s,n=e,i=void 0,(!!o&&!(o.classList.contains("quill-table__wrapper")||o.classList.contains("quill-formula-popup__input-viewarea")||o.classList.contains("quill-formula-popup__input")||o.classList.contains("pe-form-tabs-labels"))&&(o=window.getComputedStyle(o),i=["auto","scroll"].includes(o.overflowX),o=["auto","scroll"].includes(o.overflowY),i&&["horizontal","both"].includes(n)||o&&["vertical","both"].includes(n))||s===a)&&r.push(s),s=s.parentElement;return r},c=(t,e,o,n)=>{return["vertical","both"].includes(e)&&((i=t)&&0===i.scrollTop&&n<0||(i=t)&&Math.ceil(i.scrollTop+i.clientHeight)>=i.scrollHeight&&0=n.scrollWidth&&0{var{deltaX:e,deltaY:o,target:n}=t;let i;i=Math.abs(e)>Math.abs(o)?"horizontal":Math.abs(e){var{offsetHeight:t,scrollHeight:o,offsetWidth:n,scrollWidth:i}=t;return n
`}function tc__isAbortError(t){return!!(t&&t instanceof Error)&&("AbortError"===t.name||20===t.code)}function tc__getUniqueId(){let t=(new Date).getTime().toString(16);t=t.substring(t.length-6);var e=Math.random().toString(16).substring(6);return""+t+e}function tc__copyTextToClipboard(t,e,o){if(t)return navigator.clipboard.writeText(t).then(()=>{e&&td__showBubbleNotice(e)}).catch(()=>{o&&td__showBubbleNotice(o,void 0,"error")})}async function td__fetch(e){let t=null;var o=e.showLoadIcon||showLoadIcon,n=e.hideLoadIcon||hideLoadIcon;try{return e.skipLoader||(e.preloaderDelay&&!e.silent?t=window.setTimeout(o,e.preloaderDelay):e.silent||o()),await tc__fetch(e.url,e.method||"POST",e.body,e.responseType||"text",e.timeout,e.controller,e.explanation)}catch(t){throw tc__isAbortError(t)||e.silent||tc__showDialog({msg:t},"alert"),t}finally{e.skipLoader||(t&&window.clearTimeout(t),e.silent)||n()}}async function tc__fetch(t,e,o,n,i,r,s){var a=Date.now();const c=r||new AbortController;r=setTimeout(()=>{c.abort(new DOMException("Operation timed out","TimeoutError"))},1e3*(i||25));let d;try{d=await fetch(t,{method:e||"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"GET"===e?void 0:td__encodeData(o),signal:c.signal})}catch(t){if(tc__isAbortError(t))throw t;tc__throwFetchError(t,"",s)}finally{clearTimeout(r)}let l=await d.text();check_logout(l);i={status:d.status,response:l};if("/page/get/getpage/"===t&&"function"==typeof tc__checkServerError&&tc__checkServerError(i))tc__drawServerError(i.response);else{"99"!==window.$oplan&&void 0!==window.$oplan||"string"!=typeof l||"Wrong place"!==l.trim()||tc__throwFetchError("wrongplace");try{l="json"===n?JSON.parse(l):l}catch(t){tc__throwFetchError("parsing",d.status,s)}"json"===n&&l.error&&!l.error_code&&tc__throwFetchError("error",d.status,l.error);e=Date.now()-a;if(200<=d.status&&d.status<400)return l;400<=d.status&&(logAjaxError(t,o,`comm: ${o.comm}, (tc__fetch)`,d.status,{ts_delta:parseInt(e/1e3),exception:"error",ui:{ctext:s}}),tc__throwFetchError("server",d.status,s)),0===d.status&&e<100&&tc__throwFetchError("request",d.status,s)}}function tc__throwFetchError(t,e,o){var o={abort:`Request timeout (${o}). Please check your Internet connection and try again.`,parsing:`Parsing error (${o}). Please reload the page and try again.`,server:`Error status: ${e} (${o}). Please reload the page and try again.`,request:`Request error (${o}). Please reload the page and try again.`,wrongplace:"Wrong place",error:o},n=new Error;throw n.type=t,n.status=e,n.message=o[t]||o.request,n}function tc__initTooltip(e,o){var t=[`https://app.tildacdn.${tс__getRootZone()}/tfront/plugins/tooltip/t-tooltip.min.css`,`https://app.tildacdn.${tс__getRootZone()}/tfront/plugins/tooltip/t-tooltip.min.js`];return Promise.all(t.map(tc__loadResource)).then(()=>{var t=new window.Tooltip({...o,target:e});return e.tooltipInstance=t})}function tc__bunchInitTooltip(t){var e=[...t.querySelectorAll("[data-tooltip]")];t.hasAttribute("data-tooltip")&&e.push(t),e.forEach(t=>{var e=tc__parseTooltip(t.getAttribute("data-tooltip"));t.removeAttribute("data-tooltip"),tc__initTooltip(t,e)})}function tc__stringifyTooltip(t){const o=t=>t.replace(/"/g,"#quot;").replace(/'/g,"#apos;");return"string"==typeof t?o(t):JSON.stringify(t,(t,e)=>"string"==typeof e?o(e):e).replace(/"/g,""")}function tc__parseTooltip(e){if(!e)return{content:{title:""}};const o=t=>t.replace(/#quot;/g,'"').replace(/#apos;/g,"'");try{return JSON.parse(e.replace(/"/g,'"'),(t,e)=>"string"==typeof e?o(e):e)}catch{let t;return e.startsWith("info:")&&(e=e.slice("info:".length),t="info"),{content:{["info"===t?"description":"title"]:o(e)},type:t}}}class TCDropdown{constructor(t){this.setProps(t),this.isOpen=!1,this.animationController=null,this.targetElement=null,this.nestedDropdowns=[],this.resizeObserver=new ResizeObserver(this.handleScroll.bind(this)),this.handleDocClick=this.handleDocClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.render()}setProps(t){t=t||{},this.props={items:Array.isArray(t.items)?t.items:[],theme:["light","dark"].includes(t.theme)?t.theme:"light",position:["absolute","fixed"].includes(t.position)?t.position:"fixed",appendTo:t.appendTo instanceof HTMLElement?t.appendTo:document.body,top:t.top||null,bottom:t.bottom||null,left:t.left||null,right:t.right||null,zIndex:parseInt(t.zIndex,10)||0,maxWidth:parseInt(t.maxWidth,10)||300,excludeElementOnClick:t.excludeElementOnClick instanceof HTMLElement?t.excludeElementOnClick:null,onOpen:"function"==typeof t.onOpen?t.onOpen:()=>{},onClose:"function"==typeof t.onClose?t.onClose:()=>{}}}render(t){const{position:e,zIndex:o,maxWidth:H,items:n,theme:j,top:i,bottom:r,left:s,right:a}=this.props;var c="fixed"===e;const B=this.dropdown||document.createElement("div");B.removeAttribute("style"),B.removeAttribute("class"),B.innerHTML="",B.classList.add("tc-dropdown"),r&&!i&&B.classList.add("tc-dropdown_bottom"),t||B.classList.add("hidden"),"dark"===j&&B.classList.add("tc-dropdown_dark"),c&&B.classList.add("tc-dropdown_fixed");t=document.createElement("div");t.classList.add("tc-dropdown__inner"),t.addEventListener("scroll",this.handleScroll.bind(this)),B.style.cssText=`
position:${e};
z-index:${o};
${H?`max-width:min(calc(100vw - 10px), ${H}px);`:""}
${i&&!c?`top:${i};`:""}
${r&&!c?`bottom:${r};`:""}
${s&&!c?`left:${s};`:""}
${a&&!c?`right:${a};`:""}
`;const O=n.some(t=>t&&t.icon),D={Ctrl:navigator.userAgent.includes("Mac")?"⌃":"Ctrl",Alt:navigator.userAgent.includes("Mac")?"⌥":"Alt",Shift:navigator.userAgent.includes("Mac")?"⇧":"Shift",ShortKey:navigator.userAgent.includes("Mac")?"⌘":"Ctrl",Meta:navigator.userAgent.includes("Mac")?"⌘":"⊞",Backspace:navigator.userAgent.includes("Mac")?"⌫":"Backspace",Plus:"+",Minus:"-"};var d=n.map(t=>{const{separator:e,title:o,icon:n,noIconSpace:i,invertIconOnHover:r,shortcut:s,innerButtons:a,onMouseEnter:c,onMouseEnterArgs:d,onMouseLeave:l,onMouseLeaveArgs:p,onClick:u,onClickArgs:h,closeOnClick:m,skip:_,className:w,link:g,noInvertIconOnDark:f,showInputOnClick:v,inputConfig:y,checkable:b,checked:C,nestedItems:L,nestedDropdownTop:x,uplabel:k,disabled:E}=t=t||{};if(_)return!1;if(k||e){const S=document.createElement("div");return S.classList.add(k?"tc-dropdown__uplabel":"tc-dropdown__separator"),e||(S.innerHTML=`
${k}
`),S}t=Array.isArray(a)&&a.filter(({skip:t})=>!t).length;let T="button";e||t?T="div":g&&(T="a");const S=document.createElement(T);"button"===T&&(S.type="button");var A=["tc-dropdown__item","tc-dropdown__button"];if(w&&A.push(w),S.classList.add(...A),g&&(S.href=g),E&&(S.disabled=!0,S.classList.add("tc-dropdown__item_disabled"),S.tabIndex=-1),!o)return!1;b&&((A=document.createElement("span")).classList.add("tc-dropdown__item-check"),C&&A.classList.add("tc-dropdown__item-check_checked"),S.append(A)),O&&!i&&((A=document.createElement("span")).classList.add("tc-dropdown__item-icon"),n&&A.classList.add(n),r&&A.classList.add("tc-dropdown__item-icon_invert"),f&&A.classList.add("tc-dropdown__item-icon_no-invert"),S.append(A));var A=document.createElement("span");if(A.classList.add("tc-dropdown__item-title"),A.innerHTML=o,S.append(A),t&&(A=a.map(({showOnHover:t,icon:e,invertIconOnHover:o,onClick:n,onClickArgs:i,moveClickToItem:r,skip:s,showInputOnClick:a,inputConfig:c,closeOnClick:d,tooltip:l,noInvertIconOnDark:p})=>{return!s&&((s=document.createElement("button")).type="button",s.classList.add("tc-dropdown__button","tc-dropdown__item-inner-button"),t&&s.classList.add("tc-dropdown__item-inner-button_onhover"),(t=document.createElement("span")).classList.add("tc-dropdown__item-icon"),e&&t.classList.add(e),o&&t.classList.add("tc-dropdown__item-icon_invert"),p&&t.classList.add("tc-dropdown__item-icon_no-invert"),s.append(t),"function"==typeof n&&(s.addEventListener("click",t=>{t=Array.isArray(i)?i:[t];n(...t)}),r)&&S.addEventListener("click",t=>{t.target.closest(".tc-dropdown__item-inner-button, .tc-dropdown__item_input-mode")||(t=Array.isArray(i)?i:[t],n(...t))}),d&&s.addEventListener("click",t=>{t.target.closest(".tc-dropdown__item_input-mode")||this.close()}),a&&c&&(s.addEventListener("click",()=>{this.handleShowInput(c,S)}),r)&&S.addEventListener("click",t=>{t.target.closest(".tc-dropdown__item-inner-button, .tc-dropdown__item_input-mode")||this.handleShowInput(c,S)}),l&&tc__initTooltip(s,{content:{description:l},type:"info"}),s)}).filter(Boolean),(t=document.createElement("div")).classList.add("tc-dropdown__item-inner-container"),t.append(...A),S.append(t)),s&&(A=s.split("+").map(t=>{t in D&&(t=D[t]);var e=document.createElement("span");return e.classList.add("tc-shortcut","tc-dropdown__shortcut-key"),e.innerText=t,e}),(t=document.createElement("div")).classList.add("tc-dropdown__shortcut","tc-dropdown__item-inner-container"),t.append(...A),S.append(t)),Array.isArray(L)&&L.length){A=document.createElement("span");A.classList.add("tc-dropdown__item-arrow"),S.append(A),S.classList.add("tc-dropdown__item_has_nested");let t=null,e=null;let n=null;const I=()=>{t&&(window.clearTimeout(t),t=null),e||n.isOpen||(e=window.setTimeout(()=>{n.open(),e=null},200))},M=()=>{e&&(window.clearTimeout(e),e=null),t=window.setTimeout(()=>{n.close(),t=null},400)},q={items:L,theme:j,position:"absolute",appendTo:B,zIndex:1,maxWidth:H,excludeElementOnClick:S,onOpen:()=>{S.classList.add("tc-dropdown__item_active");var t=S.getBoundingClientRect(),e=S["offsetTop"],o=document.documentElement.clientWidth-(t.right+-3)-5-H,o=Math.min(o,0),t=t.left- -3-5-H,t=Math.min(t,0),e={right:null,left:null,top:x||e+"px"},t=(!o||t?(t=Math.abs(o)+-3,o=0{S.classList.remove("tc-dropdown__item_active"),t&&this.close()}};n=new TPDropdown(q),this.nestedDropdowns.push(n),S.addEventListener("mouseenter",I),S.addEventListener("click",I),S.addEventListener("mouseleave",M)}return"function"==typeof c&&S.addEventListener("mouseenter",t=>{t=Array.isArray(d)?d:[t];c(...t)}),"function"==typeof l&&S.addEventListener("mouseleave",t=>{t=Array.isArray(p)?p:[t];l(...t)}),"function"==typeof u&&S.addEventListener("click",t=>{t=Array.isArray(h)?h:[t];u(...t)}),m&&S.addEventListener("click",t=>{t.target.closest(".tc-dropdown__item_input-mode")||this.close(!1,!0,t.currentTarget)}),v&&y&&S.addEventListener("click",()=>{this.handleShowInput(y,S)}),S}).filter(Boolean);t.append(...d),B.append(t),this.dropdown=B,this.dropdownInner=t,c&&tc__scrollGuard(B)}updateFixedPosition(){var o=this["dropdown"],{left:n,top:i,position:r}=this.props;if("fixed"===r){var r=parseInt(n,10)||0,n=parseInt(i,10)||0,{clientWidth:i,clientHeight:s}=document.documentElement,{offsetWidth:a,offsetHeight:c}=o;let t=r+3,e=(i-3{"keydown"===t.type&&"Enter"!==t.key||r(a.value)}),i&&(a.addEventListener("copy",t=>{var{value:e,selectionStart:o,selectionEnd:n}=a;0===o&&n===e.length&&(t.preventDefault(),tc__copyTextToClipboard(i+e))}),a.addEventListener("paste",e=>{var{value:t,selectionStart:o,selectionEnd:n}=a,o=0===o&&n===t.length;if(o||!t){let t=e.clipboardData.getData("text")||"";(t=t.trim()).startsWith(i)&&(e.preventDefault(),a.value=t.slice(i.length))}})),o.addEventListener("click",()=>{r(a.value)})),a.focus(),a.select()}}handleHideInput(){this.dropdown.style.width="",this.dropdown.querySelectorAll(".tc-dropdown__item_input-mode").forEach(t=>{var e=t.querySelector(".tc-dropdown__input-wrapper");e&&e.remove(),t.classList.remove("tc-dropdown__item_input-mode")})}update(t){this.close(),this.setProps(t),this.render()}softUpdate(t){Array.isArray(t)&&(this.props.items=t,this.render(!0),this.updateFixedPosition())}open(t){var e,o;this.isOpen||(this.isOpen=!0,this.dropdown.style.width="",this.animationController&&this.animationController.abort(),{appendTo:e,onOpen:o}=this.props,e.append(this.dropdown),o(),window.requestAnimationFrame(()=>this.dropdown.classList.remove("hidden")),this.handleScroll(),this.updateFixedPosition(),this.resizeObserver.observe(this.dropdown),t&&(this.targetElement=t).classList.add("tc-dropdown-opened"),document.addEventListener("pointerdown",this.handleDocClick),document.addEventListener("keydown",this.handleKeyDown))}close(e,o,t){if(this.isOpen){this.resizeObserver.disconnect();const n=this.props["onClose"];e||(this.animationController=new AbortController,this.dropdown.addEventListener("transitionend",()=>{this.dropdown.remove(),this.animationController.abort(),this.handleHideInput(),n(o,t)},{signal:this.animationController.signal})),e&&(this.dropdown.remove(),this.handleHideInput(),n(o,t)),this.isOpen=!1,this.dropdown.classList.add("hidden"),document.removeEventListener("pointerdown",this.handleDocClick),document.removeEventListener("keydown",this.handleKeyDown),this.nestedDropdowns.forEach(t=>t.close(e,o)),this.targetElement&&(this.targetElement.classList.remove("tc-dropdown-opened"),this.targetElement=null)}}toggle(){this.isOpen?this.close():this.open()}handleDocClick(t){var e=this.props["excludeElementOnClick"];this.dropdown.contains(t.target)||e&&e.contains(t.target)||this.close(!1,!0)}handleKeyDown(t){"Escape"===t.key&&this.close(!1,!0)}handleScroll(){var{dropdownInner:t,dropdown:e}=this,{scrollHeight:t,scrollTop:o,offsetHeight:n}=t;e.classList.toggle("tc-dropdown_scroll",ne(...t),o)}}function tc__throttle(e,o){let n=null;return(...t)=>{n=n||window.setTimeout(()=>{e.apply(null,t),n=null},o)}}